package com.phospherus.common.controller;

import com.phospherus.common.controller.handler.ResultHandler;
import com.phospherus.common.service.IBaseService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author songjinlong
 * @version 1.0
 * @since 2017/7/10
 */
public abstract class BaseSaveController<T, SERVICE extends IBaseService> extends BaseController<T, SERVICE> {
    @RequestMapping(value = "/save", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public ResultHandler<T> save(T t) {
        return new ResultHandler(ResultHandler.SystemMessage.SUCCESS, service.save(t));
    }
}
